<template>
  <view class="body">
    <view class="title">
      <view class="line"></view>
      <view>{{ title }}</view>
    </view>
    <view v-if="type == 'normal'">
      <view v-for="(item, index) of checkList" :key="index" class="detail">
        <view class="left">{{ item.peItemName }}</view>
        <view class="right">
          <view class="result">
            <text :class="item.normal != 'n' ? 'red' : ''">{{ item.peItemResult + ' ' + item.peItemResultUnit }}</text>
            <!-- <image
              v-if="item.normal == 'h'"
              class="img_title"
              src="@/static/image/raozg/error_high.png"
            />
            <image
              v-if="item.normal == 'l'"
              class="img_title"
              src="@/static/image/raozg/error_low.png"
            /> -->
          </view>
          <view v-if="item.reference != ''" class="range">({{ item.reference }})</view>
        </view>
      </view>
      <view class="finish">
        <view class="text">小结</view>
        <view class="summary">
          <text>{{ suggest }}</text>
        </view>
      </view>
    </view>
    <view v-else>
      <view v-if="type == 'support'" class="table">
        <item v-for="(item, index) of checkList" :key="index" class="table_item">
          <view class="left">{{ item.peItemName }}</view>
          <view class="right">
            <text>{{ item.peItemResult }}</text>
          </view>
        </item>
        <item class="table_item">
          <view class="left">小结</view>
          <view class="right">
            <text style="color: #ff503d">{{ suggest }}</text>
          </view>
        </item>
      </view>
      <view v-else class="table">
        <item class="table_item">
          <view class="left">主检报告</view>
          <view class="right">
            <text>{{ suggest }}</text>
          </view>
        </item>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref, reactive } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import store from '@/store'

const type = ref('')
const title = ref('')
const suggest = ref('')
const checkList = ref([])

onLoad((option) => {
  type.value = option.type ? option.type : ''
  title.value = option.title ? option.title : ''
  suggest.value = option.suggest ? option.suggest : ''
})

onShow(() => {
  checkList.value = store.state.PHYSICAL
})
</script>

<style lang="scss" scoped>
.body {
  height: 100vh;
  padding-bottom: 32rpx;
  box-sizing: border-box;
  background: #fff;
  overflow: auto;
  .title {
    height: 108rpx;
    display: flex;
    align-items: center;
    padding-left: 30rpx;
    font-weight: 600;
    font-size: 32rpx;
    color: #222222;
    .line {
      width: 8rpx;
      height: 32rpx;
      background: #00d1b6;
      margin-right: 16rpx;
    }
  }
  .detail {
    display: flex;
    align-items: top;
    box-sizing: border-box;
    justify-content: space-between;
    padding: 32rpx;
    font-weight: 400;
    font-size: 30rpx;
    color: #222222;
    border-top: 1rpx solid #e5e6eb;
    .right {
      text-align: right;
    }
    .red {
      color: #ff503d;
    }
    .img_title {
      width: 24rpx;
      height: 24rpx;
    }
    .range {
      font-weight: 400;
      font-size: 24rpx;
      color: #999999;
      margin-top: 8rpx;
    }
  }
  .finish {
    border-top: 1rpx solid #e5e6eb;
    padding: 32rpx;
    box-sizing: border-box;
    .text {
      font-weight: 400;
      font-size: 30rpx;
      color: #222222;
      margin-bottom: 16rpx;
    }
    .summary {
      background: #fafafa;
      border-radius: 8rpx;
      padding: 24rpx;
      font-weight: 500;
      font-size: 30rpx;
      color: #ff503d;
      line-height: 50rpx;
      text-align: left;
    }
  }
  .table {
    border: 1rpx solid #e5e6eb;
    margin: 0 32rpx;
    .table_item {
      display: flex;
      &:first-child .left {
        border-top: none;
      }
      &:first-child .right {
        border-top: none;
      }
      .left {
        width: 204rpx;
        border-right: 1rpx solid #e5e6eb;
        background: #fafafa;
        font-weight: 400;
        font-size: 28rpx;
        color: #666666;
        justify-content: center;
        text-align: center;
        display: flex;
        align-items: center;
        border-top: 1rpx solid #e5e6eb;
      }
      .right {
        width: 483rpx;
        padding: 32rpx;
        font-weight: 400;
        font-size: 28rpx;
        color: #222222;
        line-height: 50rpx;
        text-align: justified;
        border-top: 1rpx solid #e5e6eb;
      }
    }
  }
}
</style>
